﻿@model PagedList<BugModel>
@using MyBlog

@if (Model.Count == 0)
{
    <div class="dv-none-tip">哇，好厉害哦，居然没人报Bug，Oh Yeah!!!</div>
}
else
{
    var uname = string.Empty;
    int i = 1;
    foreach (var item in Model)
    {
        var j = Model.TotalItemCount + 1 - ((Model.CurrentPageIndex - 1) * 10 + (i++));
        <div class="dv-msg-com-begin">
            <div class="dv-msg-com-main">
                <div class="dv-msg-com-main-header">
                    @if (!string.IsNullOrWhiteSpace(item.Uid))
                    {
                        var u = WebCache.GetAccount(item.Uid);
                        if (u.Header != null && u.Header.ID > 0)
                        {
                            <a href="@Url.Content("~/" + item.Uid)">
                                <img src="@Url.Action("GetUserHeadByUid","account", new {uid= item.Uid })" />
                            </a>
                        }
                        else
                        {
                            <img src="~/Content/Images/zanwutouxiang.jpg" />
                        }
                    }
                    else
                    {
                        <img title="游客" src="~/Content/Images/youke.gif" />
                    }
                </div>
                <div class="dv-msg-com-main-body">
                    <div class="dv-msg-com-main-body-header">
                        <span>
                            <span class="spfloor">#@(j)楼</span>
                            <span class="spuid">
                                @if (string.IsNullOrWhiteSpace(item.Uid))
                                {
                                    @item.Visitor<span class="visitor">[游客]</span>
                                }
                                else
                                {
                                    @WebCache.GetNickName(item.Uid)
                                }
                            </span>
                            <span class="sptime">@item.SendTime.ToString("yyyy-MM-dd HH:mm")</span>
                            <span class="red">发现问题：@item.TypeStr</span>
                        </span><br />
                        <span class="spcontent ueditorContent">@Html.Raw(item.BugDetail)</span>
                    </div>
                    <div class="dv-msg-com-main-body-footer">
                        <span>
                            <a href="javascript:;" onclick="replyBug(@j,@item.ID,'@((string.IsNullOrWhiteSpace(item.Visitor) ? WebCache.GetNickName(item.Uid) : item.Visitor))',@item.BugType)"><i class="icon-reply"></i> 回复</a>
                        </span>  
                        <span>
                            <a href="javascript:;" onclick="agree(@item.ID,@item.AgreeCount,this)"><i class="icon-heart"></i> 赞(@item.AgreeCount)</a>
                        </span>  
                        @if (UserSession.LoginUserInfo != null && UserSession.LoginUserInfo.IsAdmin)
                        {
                            <span>
                                <a href="javascript:;" onclick="delBug(@item.ID)"><i class="icon-remove"></i> 删除</a>
                            </span>
                        }
                    </div>
                </div>
            </div>
            @if (item.BugList.Count > 0)
            {
                Html.RenderPartial("_BugReplyList", new ViewDataDictionary { { "models", item.BugList }, { "count", j } });
            }
        </div>
    }
    if (Model.CurrentPageIndex < Model.TotalPageCount)
    {
        <div class="dv-msg-loadmore">
            <a href="javascript:;" onclick="showmore(this)">加载更多的bug</a>
        </div>
    }
    else
    {
        <div class="dv-msg-loadmore">
            没有bug了，休息一会~
        </div>
    }

    <input type="hidden" id="hidpage" value="@Model.CurrentPageIndex" />
}